package com.juyu.miliao.api.util;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

public class DayTypeUtil {

	/**
	 * @param type 1:魅力榜 2:贡献榜 3:时长榜
	 * @param day 1:日榜 2:周榜 3:总榜 4:昨日榜
	 * @return
	 * m:day:xxxx-xx-xx
	 * m:week
	 * m:sum
	 * m:yesterday:xxxx-xx-xx
	 */
	public static String getDayType(int type,int day){
		String dayStr = "";
		switch (day) {
		case 1:
			dayStr = "day";
			break;
		case 2:
			dayStr = "week";
			break;
		case 3:
			dayStr = "sum";
			break;
		case 4:
			dayStr = "day";
			break;
		}

		switch (type) {
			case 1:
				dayStr = "m:"+dayStr;
				break;
			case 2:
				dayStr = "v:"+dayStr;
				break;
			case 3:
				dayStr = "t:"+dayStr;
				break;
		}
		if(type==1 && day==1){
			dayStr= dayStr+":"+LocalDate.now().toString();
		}
		if(type==1 && day==4){
			dayStr= dayStr+":"+LocalDate.now().minusDays(1).format(DateTimeFormatter.ISO_DATE);
		}
		return dayStr;
	}
}
